doctype html
html
	head
		meta(charset="utf-8")
		meta(name="renderer" content="webkit")
		meta(http-equiv="Access-Control-Allow-Origin" content="*")
		meta(http-equiv="X-UA-Compatible" content="IE=EmulateIE11")
		meta(name="viewport" content="width=device-width, initial-scale=1.0")
		meta(name="description" content="标识汇")
		meta(name="keyword" content="标识汇")
		title 标识汇-忘记密码
		link(href="${relativePath}/static/css/common.css" type="text/css" rel="stylesheet")
		link(href="${relativePath}/static/css/login.css" type="text/css" rel="stylesheet")
	body
		div.layout.login-container
			//- 头部
			header
				div.logo.fl
					img(src="${relativePath}/static/imgs/logo.png")
				div.right-nav.fr
					ul
						li
							a(href="#") 您好！欢迎登录标识汇!
						li
							a.login-btn(href="login.html") 请登录
						li
							a(href="#") 帮助中心
						li
							a(href="#") 关于我们
						li
							a(href="#") 联系我们
						li
							a.service(href="#") 客服
		//- banner
		div.banner
			div.banner_inner.layout
				div.left_img
					img(src="${relativePath}/static/imgs/circle.png")
				div.right_box.fr
					form(name="regist").login-box#forgetLogin
						div.fl_wrap
							input.phone_num(type="text" name="phone_num" placeholder="请输入手机号")
						div.fl_wrap
							input.message_num(type="text" name="message_num" placeholder="请输入短信验证码")
							input.num_code(type="button" value="获取验证码")
						div.fl_wrap
							input.password#password(type="password" name="password" placeholder="设置密码")
						div.fl_wrap
							input.password_pre(name="password_pre" type="password" placeholder="确认密码")
						
						a.regBtn.forgetBtn(href="javascript:;") 登 录
		//- list-nav
		div.list-nav
			ul
				li
					a(href="javascript:;")
						img(src="${relativePath}/static/imgs/trade.png")
						p 行业交易
				li
					a(href="javascript:;")
						img(src="${relativePath}/static/imgs/information.png")
						p 社区资讯
				li
					a(href="javascript:;")
						img(src="${relativePath}/static/imgs/oa.png")
						p 办公OA
				li
					a(href="javascript:;")
						img(src="${relativePath}/static/imgs/erp.png")
						p 工作ERP
				li
					a(href="javascript:;")
						img(src="${relativePath}/static/imgs/bjzs.png")
						p 报价助手
				li
					a(href="javascript:;")
						img(src="${relativePath}/static/imgs/gxc.png")
						p 供销存
		//- 底部
		div.footer
			div.footer-inner
				div.left
					p 标识汇官网|成品材料|定制加工|需求中心|社区资讯|工作ERP|办公OA微单系统|供销存
					p @copy;2015标识汇  豫ICP备15032515
					p 版权所有：标识汇网络技术有限公司
				div.code
					div.code_1
						img(src="${relativePath}/static/imgs/code_1.png")
						p 下载手机标识汇
					div.code_2
						img(src="${relativePath}/static/imgs/code_2.png")
						p 关注微信公众号

block pageScript
	script(type="text/javascript" src="${relativePath}/static/js/jquery.min.js")
	script(type="text/javascript" src="${relativePath}/static/js/libs/jquery.cookie.js")
	script(type="text/javascript" src="${relativePath}/static/js/common.js")
	script(type="text/javascript" src="${relativePath}/static/js/jquery.validate.min.js")
	script(type="text/javascript" src="${relativePath}/static/js/messages_zh.js")
	script(src="${relativePath}/static/js/libs/layer/layer.js")

	script.
			// 手机号码验证
		jQuery.validator.addMethod("isMobile", function(value, element) {
			var length = value.length;
			var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
			return this.optional(element) || (length == 11 && mobile.test(value));
		}, "请正确填写您的手机号码");
		//- 发送验证码
		var countdown=60;
		function settime(obj) {
		    if (countdown == 0) {
		        obj.removeAttribute("disabled");    
		        obj.value="获取验证码";
		        countdown = 60;
		        return;
		    } else {
		        obj.setAttribute("disabled", true);
		        obj.value="重新发送(" + countdown + ")";
		        countdown--;
		    }
		setTimeout(function() {
		    settime(obj) }
		    ,1000)
		}
		
		var validator = $("#forgetLogin").validate({
				rules: {
					phone_num:{
						required:true,
						isMobile:true
					},
					message_num:{
						required:true,
					},
					password:{
						required: true
					},
					password_pre:{
						required: true,
						equalTo: "#password"
					}
				},
				messages : {
			        phone_num:{
			        	required:'请输入手机号'
			        },
			        message_num:{
			        	required:'请输入验证码'
			        },
			        password:{
			        	required:'请输入密码'
			        },
			        password_pre:{
			        	required:'请确认密码',
			        	equalTo: "两次密码输入不一致"
			        }
			    },
			});
		
		//- 点击发送验证码
		$(".num_code").click(function(){
			var phoneNum = $(".phone_num").val();
			var _this = this;
			if(phoneNum == ""){
				layer.msg("请输入手机号");
				return false;
			}else{
				$.ajax({
					url:shopIp+"/Utils/sendCaptcha",
					type:"post",
					data:{
						os:"web",
						phone:phoneNum,
					},
					dataType: "jsonp",
				}).done(function(data){
					if(data.status == "200"){
						settime(_this);
					}else{
						layer(data.msg);
					}
				})
			}
		})

		//- 点击登录发送请求
		$(".forgetBtn").click(function(){
			var phoneNum = $(".phone_num").val();
			var message_num = $(".message_num").val();
			var password = $(".password").val();
			var password_pre = $(".password_pre").val();
			if(validator.form()){
				$.getJSON(shopIp+"/account/setPassword?callback=?",{
					os:"web",
					phone:phoneNum,
					smsCode:message_num,
					password:password,
					repassword:password_pre
				},function(data){
					console.log(data);
					if(data.status == "200"){
						window.location.href="regist.html";
					}
				})
			}
			localStorage.removeItem('keyPass');
		})






